function a(x) { return x + 2 }
function b(x) { return x + 3 }
function c(x) { return x + 5 }

function compound(...fns) {
  return x => fns.reduce((promise, fn) => promise.then(fn), Promise.resolve(x))
}

const result = compound(a, b, c)
result(10).then(console.log)
